import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.*;
import java.awt.*;

public class MyRenderer extends DefaultTableCellRenderer {

	public Component getTableCellRendererComponent(JTable table, Object  value, boolean isSelected, boolean hasFocus, int row, int column) {

		if (isSelected) {
			super.setForeground(table.getSelectionForeground());
			super.setBackground(table.getSelectionBackground());
		}
		else {
			super.setForeground(table.getForeground());
			
			if (Integer.parseInt(((String)table.getValueAt(row,1)).substring(5,7)) % 2 == 0) 
				super.setBackground(Color.lightGray);
			else 
				super.setBackground(table.getBackground());
		}
     
		setFont(table.getFont());

		if (hasFocus) {
			Border border = null;
			if (isSelected) {                 
				border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
			}             
			if (border == null) {
				border = UIManager.getBorder("Table.focusCellHighlightBorder");
			}
			setBorder(border);

			if (!isSelected && table.isCellEditable(row, column)) {
				Color  col;
				col = UIManager.getColor("Table.focusCellForeground");
				if (col != null) {
					super.setForeground(col);                 
				}
				col = UIManager.getColor("Table.focusCellBackground");
				if (col != null) {
					super.setBackground(col);
				}
			}
		} else {
			setBorder(noFocusBorder);
		}

		setValue(value);

		return this;
	}

}
